﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SmallJob.Data;
using SmallJob.Model;
using SmallJob.Services.Interfaces;
using SmallJob.Data.Interfaces;

namespace SmallJob.Services.Implements
{
    public class OfferService: RepositoryBase<Offer>,IOfferService
    {
        public OfferService(IDatabaseFactory DBFactory)
            :base(DBFactory)
        { }
        public List<Offer> GetOfferByRequestID(int id){
            var list = from o in SmallJobDB.Offers
                       where o.RequestID == id
                       orderby o.CreatedDate descending
                       select o;
            return list.ToList();
        }
        public List<Offer> GetOfferByUserID(int id)
        {
            var list = from o in SmallJobDB.Offers
                       where o.UserID == id
                       orderby o.CreatedDate descending
                       select o;
            return list.ToList();
        }
    }
}
